*----------------------------------------------------------------------------------------------------------	* 
* RESEARCHERS:		EARN												   									*
* PROGRAMMED BY:	Linea Hasager																			*
* DESCRIPTION:		Robustness tests: Placebo tests at other fictive cutoffs.						 		*
* CREATED:			Jan. 7, 2019																		   	*
* LAST MODIFIED:	May 25, 2022														       				*
*----------------------------------------------------------------------------------------------------------	*


clear 
set more off

// Directories
global in "L:\Workdata\707455\Papers\ABFHP_1999reform\Code\ReStat\Input"
global output "L:\Workdata\707455\Papers\ABFHP_1999reform\Code\ReStat\Output"
global temp "L:\Workdata\707455\Papers\ABFHP_1999reform\Code\ReStat\Temp"


*--------------------------------------------------------------------------------------------------------	

********************************
* 1) LOAD DATA
********************************
use "${in}\Analysis_sample.dta", replace


*SHORTEN NAME
rename non_complex_job_y18 n_complex_job_y18	
	


********************************
*	2) ESTIMATIONS AND GRAPHS
********************************


eststo clear
*EARNINGS
local var loenmv_13_y_18
forval placebo= 540(-30)180 {
rdrobust `var'_sum day_nr if year_admission <= 1998,  kernel(tri) c(-`placebo') p(1)  
eststo `var'_sumpc_`placebo'
rdrobust `var'_sum day_nr  if year_admission > 1998,  kernel(tri) c(`placebo')  p(1) 
eststo `var'`placebo'
}
rdrobust `var'_sum day_nr, kernel(tri) c(0) p(1)
gen beta= _b[RD_Estimate] 
levelsof beta, local(beta)
coefplot (`var'_sumpc_540, aseq(-540) \ `var'_sumpc_510, aseq(-510) \ `var'_sumpc_480, aseq(-480) \ `var'_sumpc_450, aseq(-450) \ `var'_sumpc_420, aseq(-420) \ `var'_sumpc_390, aseq(-390)  \ `var'_sumpc_360, aseq(-360) \ `var'_sumpc_330, aseq(-330)  \ `var'_sumpc_300, aseq(-300)  \ `var'_sumpc_270, aseq(-270)  \ `var'_sumpc_240, aseq(-240) \ `var'_sumpc_210, aseq(-210)  \ `var'_sumpc_180, aseq(-180) \ `var'180, aseq(180) \ `var'210, aseq(210) \ `var'240, aseq(240) \ `var'270, aseq(270) \ `var'300, aseq(300) \ `var'330, aseq(330) \ `var'360, aseq(360) \ `var'390, aseq(390) \ `var'420, aseq(420) \ `var'450, aseq(450) ///
\ `var'480, aseq(480) \ `var'510, aseq(510) \ `var'540, aseq(540) mcolor(black) ciopts(color(black) )) , yline(0,  lpattern(dash) lcolor(gs5)) yline(`beta',  lpattern(solid) lcolor(red)) vertical swapnames graphregion(color(white)) xlabel(, angle(vertical)) xtitle("Placebo Cutoff (Deviation from January 1, 1999)")  format(%10.0fc) ytitle("Thousand USD") ylab(-10(5)15)
graph export "${output}\oa_figure6a.png", replace width(5000)
drop beta




eststo clear
*EMPLOYMENT
local var employment_y_18
forval placebo= 540(-30)180 {
rdrobust `var'_sum day_nr if year_admission <= 1998,  kernel(tri) c(-`placebo') p(1)  
eststo `var'_sumpc_`placebo'
rdrobust `var'_sum day_nr  if year_admission > 1998,  kernel(tri) c(`placebo')  p(1) 
eststo `var'`placebo'
}
rdrobust `var'_sum day_nr, kernel(tri) c(0) p(1)
gen beta= _b[RD_Estimate] 
levelsof beta, local(beta)
coefplot (`var'_sumpc_540, aseq(-540) \ `var'_sumpc_510, aseq(-510) \ `var'_sumpc_480, aseq(-480) \ `var'_sumpc_450, aseq(-450) \ `var'_sumpc_420, aseq(-420) \ `var'_sumpc_390, aseq(-390)  \ `var'_sumpc_360, aseq(-360) \ `var'_sumpc_330, aseq(-330)  \ `var'_sumpc_300, aseq(-300)  \ `var'_sumpc_270, aseq(-270)  \ `var'_sumpc_240, aseq(-240) \ `var'_sumpc_210, aseq(-210)  \ `var'_sumpc_180, aseq(-180) \ `var'180, aseq(180) \ `var'210, aseq(210) \ `var'240, aseq(240) \ `var'270, aseq(270) \ `var'300, aseq(300) \ `var'330, aseq(330) \ `var'360, aseq(360) \ `var'390, aseq(390) \ `var'420, aseq(420) \ `var'450, aseq(450) ///
\ `var'480, aseq(480) \ `var'510, aseq(510) \ `var'540, aseq(540) mcolor(black) ciopts(color(black) )) , yline(0,  lpattern(dash) lcolor(gs5)) yline(`beta',  lpattern(solid) lcolor(red)) vertical swapnames graphregion(color(white)) xlabel(, angle(vertical)) xtitle("Placebo Cutoff (Deviation from January 1, 1999)")  format(%10.1fc) ytitle("Average Annual Rate of Employment") ylab(-0.2(0.1)0.3)
graph export "${output}\oa_figure6b.png", replace width(5000)
drop beta








eststo clear
*COMPLEX JOB
local var complex_job_y18 
forval placebo= 540(-30)180 {
rdrobust `var' day_nr if year_admission <= 1998,  kernel(tri) c(-`placebo') p(1)  
eststo `var'_sumpc_`placebo'
rdrobust `var' day_nr  if year_admission > 1998,  kernel(tri) c(`placebo')  p(1) 
eststo `var'`placebo'
}
rdrobust `var' day_nr, kernel(tri) c(0) p(1)
gen beta= _b[RD_Estimate] 
levelsof beta, local(beta)
coefplot (`var'_sumpc_540, aseq(-540) \ `var'_sumpc_510, aseq(-510) \ `var'_sumpc_480, aseq(-480) \ `var'_sumpc_450, aseq(-450) \ `var'_sumpc_420, aseq(-420) \ `var'_sumpc_390, aseq(-390)  \ `var'_sumpc_360, aseq(-360) \ `var'_sumpc_330, aseq(-330)  \ `var'_sumpc_300, aseq(-300)  \ `var'_sumpc_270, aseq(-270)  \ `var'_sumpc_240, aseq(-240) \ `var'_sumpc_210, aseq(-210)  \ `var'_sumpc_180, aseq(-180) \ `var'180, aseq(180) \ `var'210, aseq(210) \ `var'240, aseq(240) \ `var'270, aseq(270) \ `var'300, aseq(300) \ `var'330, aseq(330) \ `var'360, aseq(360) \ `var'390, aseq(390) \ `var'420, aseq(420) \ `var'450, aseq(450) \ `var'480, aseq(480) \ `var'510, aseq(510) \ `var'540, aseq(540) mcolor(black) ciopts(color(black) )) , yline(0,  lpattern(dash) lcolor(gs5)) yline(`beta',  lpattern(solid) lcolor(red)) vertical swapnames graphregion(color(white)) xlabel(, angle(vertical)) xtitle("Placebo Cutoff (Deviation from January 1, 1999)")  format(%10.2fc) ytitle("Share") 
graph export "${output}\oa_figure6c.png", replace width(5000)
drop beta



eststo clear
*NON-COMPLEX JOB
local var n_complex_job_y18 
forval placebo= 540(-30)180 {
rdrobust `var' day_nr if year_admission <= 1998,  kernel(tri) c(-`placebo') p(1)  
eststo `var'_sumpc_`placebo'
rdrobust `var' day_nr  if year_admission > 1998,  kernel(tri) c(`placebo')  p(1) 
eststo `var'`placebo'
}
rdrobust `var' day_nr, kernel(tri) c(0) p(1)
gen beta= _b[RD_Estimate] 
levelsof beta, local(beta)
coefplot (`var'_sumpc_540, aseq(-540) \ `var'_sumpc_510, aseq(-510) \ `var'_sumpc_480, aseq(-480) \ `var'_sumpc_450, aseq(-450) \ `var'_sumpc_420, aseq(-420) \ `var'_sumpc_390, aseq(-390)  \ `var'_sumpc_360, aseq(-360) \ `var'_sumpc_330, aseq(-330)  \ `var'_sumpc_300, aseq(-300)  \ `var'_sumpc_270, aseq(-270)  \ `var'_sumpc_240, aseq(-240) \ `var'_sumpc_210, aseq(-210)  \ `var'_sumpc_180, aseq(-180) \ `var'180, aseq(180) \ `var'210, aseq(210) \ `var'240, aseq(240) \ `var'270, aseq(270) \ `var'300, aseq(300) \ `var'330, aseq(330) \ `var'360, aseq(360) \ `var'390, aseq(390) \ `var'420, aseq(420) \ `var'450, aseq(450) \ `var'480, aseq(480) \ `var'510, aseq(510) \ `var'540, aseq(540) mcolor(black) ciopts(color(black) )) , yline(0,  lpattern(dash) lcolor(gs5)) yline(`beta',  lpattern(solid) lcolor(red)) vertical swapnames graphregion(color(white)) xlabel(, angle(vertical)) xtitle("Placebo Cutoff (Deviation from January 1, 1999)")  format(%10.2fc) ytitle("Share") 
graph export "${output}\oa_figure6d.png", replace width(5000)
drop beta
